Option Public
Option Explicit
Sub Initialize
	'set up error handler
	On Error GoTo catch
	
	'变量定义
	Dim s As New NotesSession'当前进程
	Dim dbCur As NotesDatabase'当前数据库
	Dim collection As NotesDocumentCollection'文档的集合
	Dim doc As NotesDocument'处理的文档
	
	
	'变量初始化
	Set dbCur = s.CurrentDatabase
	Set collection = dbCur.AllDocuments
	
	Set doc = collection.GetFirstDocument'获得第一个要处理的文档
	While Not doc Is Nothing'当集合中没有要处理的文档时退出
		'处理文档
		
		'获得下一要处理的文档
		Set doc = collection.GetNextDocument(doc)
	Wend
	
	GoTo finally
catch:
	'log error
	MsgBox Erl & ":" & Error
	'resume to the final thing
	Resume finally
	
finally:
	'do the final thing
	Exit Sub
End Sub